<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>订单管理-车速递</title>
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="layui/css/layui.css" media="all">
    <link rel="stylesheet" href="css/mymain.mymain.css">
    <script type="application/javascript" src="js/jquery-3.3.1.js"></script>
    <script type="application/javascript" src="js/bootstrap.min.js"></script>
    <script type="application/javascript" src="layui/layui.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>

</head>
<body style="position: static">

<div id="app" class="bgGray">
    <div data-v-95ac8d30="" class="header3">
        <div data-v-95ac8d30="" class="layout clear">
            <div data-v-95ac8d30="" class="left logo">
                <a data-v-95ac8d30="" href="index.html">
                    <img data-v-95ac8d30=""
                         src="">
                </a>
            </div>
            <div data-v-95ac8d30="" class="header3Nav right">|<a data-v-95ac8d30="" href="orderManage.html">我的订单</a>|<a
                    data-v-95ac8d30="" href="https://www.chesudi.com/module/helpCenter.html">帮助中心</a>|<a
                    data-v-95ac8d30=""
                    href="loginsuccess.html">退出</a>
            </div>
            <div data-v-95ac8d30="" class="header3User right">
                <i data-v-95ac8d30="" class="iconfont icon-phone"></i>
                <span data-v-95ac8d30="" class="sp1">400-919-8000</span>
                <span data-v-95ac8d30="" class="sp2"></span>
                <span data-v-95ac8d30="" class="sp3"></span>
            </div>
        </div>
    </div>
    <div class="userInfo">
        <div class="layout">
            <div class="userInfoCom clear">
                <div class="userInfoL left">
                    <div data-v-1cae2c34="" class="userNav">
                        <dl data-v-1cae2c34="" class="userMsg">
                            <dt data-v-1cae2c34="">
                                <img data-v-1cae2c34=""
                                     src="">
                            </dt>
                            <dd data-v-1cae2c34="">
                                <p data-v-1cae2c34=""></p>
                                <p data-v-1cae2c34="" class="p5 pp" style="">普卡会员</p>
                            </dd>
                        </dl>
                        <ul data-v-1cae2c34="" class="manNav">
                            <li data-v-1cae2c34="">
                                <a data-v-1cae2c34="" href="orderManage.html" class="sel">订单管理</a>
                            </li>
                            <li data-v-1cae2c34="">
                                <a data-v-1cae2c34="" href="myinfo.html" class="">个人信息</a>
                            </li>
                        </ul>
                    </div>
                </div>
                <div class="userInfoR right">

                    <div class="orderManage manage">
                        <div class="orderManageTit manageTit clear">
                            <div class="left tit">订单管理</div>
                        </div>
                        <div class="orderType clear type">
                            <div class="sel">全部订单</div>
                        </div>
                        <div class="orderList list">
                            <div class="orderListCom listCom" style="position: static;">
                                <table cellspacing="0" cellpadding="0">
                                    <tr class="firstTr">
                                        <th>订单号</th>
                                        <th>订单金额</th>
                                        <th>车型</th>
                                        <th>取车地址</th>
                                        <th>还车地址</th>
                                        <th>操作</th>
                                    </tr>
                                </table>
                                <div class="noData" id="noda">

                                    <table cellspacing="0" cellpadding="0">
                                        <tr class="firstTr" v-for="(site, i) in sites" :key="site">
                                            <td id="oid">{{site.oid}}</td>
                                            <td>{{site.totalprice}}</td>
                                            <td>{{site.carname}}</td>
                                            <td>{{site.getcity}}</td>
                                            <td>{{site.backcity}}</td>
                                            <td>
                                                <button data-method="offset" data-type="auto"
                                                        class="layui-btn layui-btn-danger" onclick="deleteOrder()">删除
                                                </button>
                                            </td>
                                        </tr>
                                    </table>
                                    <div id="fenye"></div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div data-v-3aaf9db2="" class="footer2">
        <div data-v-3aaf9db2="" class="layout clear">
            <div data-v-3aaf9db2="" class="d1">
                <a data-v-3aaf9db2="" href="about.html">关于车速递</a></div>
        </div>
    </div>
</div>
</body>

<script>
    var pid = window.localStorage.getItem("pid");
    new Vue({
        el: '#noda',
        data: {
            sites: []
        },
        created: function () {
            var sites = this;
            $.ajax({
                url: '/Order/OrderByPid/' + pid,
                type: 'post',
                contentType: 'application/json',
                dataType: 'json'
            }).then(function (res) {
                sites.sites = res.data;
            })
        }
    });
</script>
<script>
    function deleteOrder() {
        var oid = $("#oid").text();
            $.ajax({
                url: '/Order/OrderDelete/' + oid,
                type: "post",
                contentType: "application/json",
                dataType: "json",
                success: function (res) {
                    alert("删除成功");
                    window.location.reload();
                }
        })
    }
</script>
<script>
    $(function () {
        var id = window.localStorage.getItem("pid");
        console.log(id);
        $.ajax({
            url: "/Person/PersonByPid/" + id,
            dataType: "json",
            type: 'post',
            contentType: 'application/json',
            success: function (res) {
                var data = res;
                $(".sp2").text("欢迎您，" + data.name);
            }
        })
    })
</script>
</html>